package com.desgin.factory_mod.simple.fac;

import com.desgin.factory_mod.simple.operation.*;

/**
 * Created by zhaoshuai on 2017/4/10.
 */
public class OperationFactory {

    public static Operation createOperation(String operationCode) {

        Operation operation = null;

        switch (operationCode) {
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
            default:
                operation = new OperationAdd();
                break;
        }


        return operation;

    }

}
